#packages: 
library(dplyr)
library(ggplot2)
library(DeclareDesign)
library(texreg)
library(cobalt)
library(WeightIt)
library(texreg)
library(psych)

#read in data and clean --------------
data <- read.csv('/Users/amygrauley/Desktop/Notre Dame/CN Elite Cues Experiment/EXP 1 DATA FINAL.csv')

#how many people did not pass the attention check
count_somewhat_disagree <- table(data$ATTENTION == "Somewhat disagree")[TRUE]
count_somewhat_disagree

#recoding to a binary variable where "1" is passing the attention check and "0" is not 
data <- data %>%
  mutate(ATTENTION = case_when(
    ATTENTION == "Strongly disagree" ~ 0, 
    ATTENTION == "Somewhat disagree" ~ 1, 
    ATTENTION == "Neither agree nor disagree" ~ 0, 
    ATTENTION == "Somewhat agree" ~ 0, 
    ATTENTION == "Strongly agree" ~ 0
  ))

#remove all who did not pass attention check from the data 
data <- data[data$ATTENTION != "0", ]

count_nopass <- table(data$ATTENTION == "1")[TRUE]
count_nopass

#remove first three empty rows from data
data <- data[!rownames(data) %in% c("NA", "NA.1", "NA.2"), , drop = FALSE]


#creating bins for CN score groups 
data <- data %>% 
  mutate(CN.Score2 = case_when(CN.Score == 0 ~ 1, #rejecters
                               CN.Score > 0 & CN.Score < 0.5 ~ 2, #skeptics
                               CN.Score > 0.49 & CN.Score < 0.75 ~ 3, #sympathizers
                               CN.Score > 0.74 ~ 4)) #adherents
#does the same thing as the block ID category 


#Creating a 7-point PID scale 
data <- data %>%
  mutate(PID = case_when(
    PARTY.ID. == "Republican" & R_STRENGTH == "A strong Republican" ~ 7,
    PARTY.ID. == "Republican" & R_STRENGTH == "Not a very strong Republican" ~ 6,
    PARTY.ID. == "Independent" & I_STRENGTH == "Republican" ~ 5,
    PARTY.ID. == "Independent" & I_STRENGTH == "Neither" ~ 4,
    PARTY.ID. == "Independent" & I_STRENGTH == "Democratic" ~ 3,
    PARTY.ID. == "Democrat" & D_STRENGTH == "Not a very strong Democrat" ~ 2,
    PARTY.ID. == "Democrat" & D_STRENGTH == "A strong Democrat" ~ 1,
    TRUE ~ NA_integer_
  ))

#Coding ideology as numeric
data <- data %>% 
  mutate(IDEOLOGY. = case_when(IDEOLOGY. == "Very conservative" ~ 7, 
                               IDEOLOGY. == "Conservative" ~ 6, 
                               IDEOLOGY. == "Slightly conservative " ~ 5, 
                               IDEOLOGY. == "Moderate" ~ 4, 
                               IDEOLOGY. == "Slightly liberal" ~ 3,
                               IDEOLOGY. == "Liberal" ~ 2, 
                               IDEOLOGY. == "Very liberal" ~ 1, )) 

#coding religious importance as numeric 
data <- data %>% 
  mutate(REL_IMPORTANCE = case_when(
    REL_IMPORTANCE == "Religion is the most important thing in my life " ~ 4, 
    REL_IMPORTANCE == "Religion is one among many important things in my life " ~ 3, 
    REL_IMPORTANCE == "Religion is not as important as other things in my life " ~ 2, 
    REL_IMPORTANCE == "Religion is not important in my life" ~ 1
  ))



#making CN_MEASUREMENTs into numeric data
data <- data %>%
  mutate(CN_MEASUREMENT_1 = case_when(
    CN_MEASUREMENT_1 == "Strongly disagree" ~ 1, 
    CN_MEASUREMENT_1 == "Somewhat disagree" ~ 2, 
    CN_MEASUREMENT_1 == "Neither agree nor disagree" ~ 3, 
    CN_MEASUREMENT_1 == "Somewhat agree" ~ 4, 
    CN_MEASUREMENT_1 == "Strongly agree" ~ 5
  ),
  CN_MEASUREMENT_2 = case_when(
    CN_MEASUREMENT_2 == "Strongly disagree" ~ 1, 
    CN_MEASUREMENT_2 == "Somewhat disagree" ~ 2, 
    CN_MEASUREMENT_2 == "Neither agree nor disagree" ~ 3, 
    CN_MEASUREMENT_2 == "Somewhat agree" ~ 4, 
    CN_MEASUREMENT_2 == "Strongly agree" ~ 5
  ),
  CN_MEASUREMENT_3 = case_when(
    CN_MEASUREMENT_3 == "Strongly disagree" ~ 1, 
    CN_MEASUREMENT_3 == "Somewhat disagree" ~ 2, 
    CN_MEASUREMENT_3 == "Neither agree nor disagree" ~ 3, 
    CN_MEASUREMENT_3 == "Somewhat agree" ~ 4, 
    CN_MEASUREMENT_3 == "Strongly agree" ~ 5
  ),
  CN_MEASUREMENT_4 = case_when(
    CN_MEASUREMENT_4 == "Strongly disagree" ~ 1, 
    CN_MEASUREMENT_4 == "Somewhat disagree" ~ 2, 
    CN_MEASUREMENT_4 == "Neither agree nor disagree" ~ 3, 
    CN_MEASUREMENT_4 == "Somewhat agree" ~ 4, 
    CN_MEASUREMENT_4 == "Strongly agree" ~ 5
  ),
  CN_MEASUREMENT_5. = case_when(
    CN_MEASUREMENT_5. == "Strongly disagree" ~ 1, 
    CN_MEASUREMENT_5. == "Somewhat disagree" ~ 2, 
    CN_MEASUREMENT_5. == "Neither agree nor disagree" ~ 3, 
    CN_MEASUREMENT_5. == "Somewhat agree" ~ 4, 
    CN_MEASUREMENT_5. == "Strongly agree" ~ 5
  ))

#outcome variables-----------------
#coding vote choice as numeric 
data <- data %>%
  mutate(VOTE_CHOICE = case_when(
    VOTE_CHOICE == "Extremely unlikely" ~ 5, 
    VOTE_CHOICE == "Somewhat unlikely" ~ 4, 
    VOTE_CHOICE == "Neither likely nor unlikely" ~ 3, 
    VOTE_CHOICE == "Somewhat likely" ~ 2, 
    VOTE_CHOICE == "Extremely likely" ~ 1))

#coding William's party as numeric: 
data <- data %>%
  mutate(WILLIAMS_PARTY = case_when(
    WILLIAMS_PARTY == "Republican" ~ 1, 
    WILLIAMS_PARTY == "Independent" ~ 4, 
    WILLIAMS_PARTY == "Democrat" ~ 7))

#coding social ties measurement of CN as numeric , 5= most CN
data <- data %>%
  mutate(FRIEND_EVENT_CN = case_when(
    FRIEND_EVENT_CN == "Yes" ~ 5, 
    FRIEND_EVENT_CN == "Maybe yes" ~ 4, 
    FRIEND_EVENT_CN == "Unsure/Don't Know" ~ 3, 
    FRIEND_EVENT_CN == "Maybe no" ~ 2, 
    FRIEND_EVENT_CN == "No" ~ 1))

#coding conversational identification measurement of CN as numeric , 5= most CN
data <- data %>%
  mutate(CN_WE = case_when(
    CN_WE == "Always" ~ 5, 
    CN_WE == "Often" ~ 4, 
    CN_WE == "Seldom" ~ 3, 
    CN_WE == "Never" ~ 2, 
    CN_WE == "Other:" ~ 1))

#coding CN measurement as numeric, 5= most CN
data <- data %>%
  mutate(CN_IDENTIFICATION = case_when( 
    CN_IDENTIFICATION == "Strongly disagree" ~ 1, 
    CN_IDENTIFICATION == "Somewhat disagree" ~ 2, 
    CN_IDENTIFICATION == "Neither agree nor disagree" ~ 3, 
    CN_IDENTIFICATION == "Somewhat agree" ~ 4, 
    CN_IDENTIFICATION == "Strongly agree" ~ 5))

#coding public identification with researcher contact as numeric, 5= most CN
data <- data %>%
  mutate(FUTHER_CONVERSATION = case_when( 
    FUTHER_CONVERSATION == "Yes" ~ 5, 
    FUTHER_CONVERSATION == "No, but I do identify with Christian Nationalism" ~ 3, 
    FUTHER_CONVERSATION == "No, because I do not identify with Christian Nationalism" ~ 1))

#coding for balance tests 

#coding religion as protestant/evangelical vs not, binary 1-0
data <- data %>%
  mutate(religion_binary = case_when( 
    RELIGION == "Catholic" ~ 0, 
    RELIGION == "Mainline Protestant" ~ 1, 
    RELIGION == "Other Protestant" ~ 1, 
    RELIGION == "Evangelical Protestant" ~ 1, 
    RELIGION == "None of the above" ~ 0, 
    RELIGION == "Other:" ~ 0, 
    RELIGION == "Jewish" ~ 0, 
    RELIGION == "Other Christian" ~ 0, 
    RELIGION == "Latter-Day Saint" ~ 0, 
    RELIGION == "Other Christian non-religious" ~ 0))

#coding gender as male/nonmale, binary 1-0
data <- data %>%
  mutate(gender_binary = case_when( 
    GENDER == "Man" ~ 1, 
    GENDER == "Non-binary / third gender-" ~ 0, 
    GENDER == "Prefer not to say" ~ 0, 
    GENDER == "Woman" ~ 0))

data <- data %>%
  mutate(income_numeric = case_when( 
    INCOME == "Less than $10,000" ~ 1, 
    INCOME == "$10,000 - $19,999" ~ 2, 
    INCOME == "$20,000 - $29,999" ~ 3, 
    INCOME == "$30,000 - $39,999" ~ 4, 
    INCOME ==  "$40,000 - $49,999" ~ 5, 
    INCOME == "$50,000 - $59,999" ~ 6, 
    INCOME == "$60,000 - $69,999" ~ 7, 
    INCOME ==  "$70,000 - $79,999" ~ 8, 
    INCOME ==  "$80,000 - $89,999" ~ 9, 
    INCOME ==  "$90,000 - $99,999" ~ 10,
    INCOME == "$100,000 - $149,999" ~ 11, 
    INCOME == "More than $150,000" ~12))

data <- data %>%
  mutate(age_numeric = case_when( 
    AGE == "18 - 24" ~ 1, 
    AGE == "25 - 34" ~ 2, 
    AGE == "35 - 44" ~ 3, 
    AGE == "45 - 54" ~ 4, 
    AGE ==  "55 - 64" ~ 5, 
    AGE == "65 - 74" ~ 6, 
    AGE == "75 - 84" ~ 7))

#creating a binary variable for race
data <- data %>% 
  mutate(race_binary = case_when(
    RACE == "White, non- Hispanic"  ~ 1, 
    RACE == "Hispanic" ~ 0, 
    RACE == "Asian" ~ 0, 
    RACE == "Black or African American, non- Hispanic" ~ 0, 
    RACE == "American Indian or Alaskan Native" ~ 0, 
    RACE ==  "Multiple races, non-Hispanic" ~ 0, 
    RACE == "Other:" ~ 0, 
    RACE == "Native Hawaiian or other Pacific Islander" ~ 0
  ))


#remove respondents who saw two treatments from data----------------------
data_correct <- data[!data$participantId %in% c(
  "011BAE6A4CE2441382BB78958F93D17D",
  "33AA135E2637478D90D198D800055C1D",
  "E675477C7BED4108BA6A2F66D83C4EBE",
  "C809D394C2CD4B3296F6F24D523DE626",
  "F2B578EB6E8A42F492A10DE747BFC18A",
  "C57A2DB009C54BE4B7A643E5C7178572",
  "EB3FD070E0B34CD9B9F3129C0C4F0137",
  "A5DD87C51D044489A83F3E76946D583E",
  "0B8D09A73ED140CF84C5320DAE27F350",
  "A09E5BE893AD458F962CAFB15189D7D7",
  "7FC54A2BBBA844EC88AC2A5565845AC7",
  "B2AE6B6C6C6C448E944D560048796462",
  "C5D221F3F24D4FC69E19B762A31A72F7",
  "DA8B15BC54254E0FBD50D7B01A50DBE8",
  "43AD75CE951840A2A1DA5F1452CFEF76",
  "DDBDAB1F7A064D20BF141E8B48C0C19A",
  "4BD45001E6CD42B294550A18DEDBC0B2",
  "24FFE0BDA1A4475B930831F327B0BDAC",
  "73027FE6F7834DF4945223C6D9BBC91F",
  "207E8CAE241C4C5E8E6EBFFB401AEA47",
  "E76ADCA2C1174B6CB484B1D56BB3270E",
  "DA482FE2174A465B93512F7ACFAFB4BF",
  "214E41BE5B29475D8B554B34A9290A07",
  "CCAE55BD0FA14D3BBD03CD4DBC761141",
  "213B82DA44A745FA804750396D9B1FB8",
  "7FE57D69C1494880853DE2F113880788",
  "5FA5C3EF9195444A832F0AE438613FE8",
  "363DEB2413FB48FD9D4CDCFD0EFE8171",
  "558C6C2E93914C0EBA625E42F900F002",
  "AE1915713E6D406ABCEED46C89E42282",
  "E458A546FAFC4A43895570E127E1EA05",
  "E29DEBF81BFD499FB98C2E5FBE185C4E",
  "C9BF53412788445E8DF6EA065AFFA0A6",
  "82ACF0E6EAF54359A0829C5958420F69",
  "BC9E6A6E734741679910D6D1A22E7643",
  "C69D887798B6438E9A8CDE24492B07AE",
  "0660BC35F9D84A76AD94D044AB3E2F03",
  "DEE6E272C4984FBFB0CAB3AC2CA380C6",
  "468663412E82440A8CA94360BB6691B3",
  "4C996CBA7A25444D9FFBD5938F22D79E",
  "97725CCC05DC4F978825D45FB3EB168C",
  "21C9CCA31AAC4871AF17A99AF86F6B8B",
  "FBE43D1FCAE84EDBBD1EBD3D94E73E9F",
  "5771BBE6465940CA82548F137A6790D9",
  "4AB0A44753C54C48B0C3F735CD088259",
  "ECAEFE5A63CA472C8E6CABBEFAC0539D",
  "3C66CEFE105C420CBDB539B9DCB3843C",
  "93A410F441A54BA1B25CA56C8974C7D1",
  "94C968BE05384FDA97F90AEF8F184D69",
  "5A1913E5D6BD434896085BD0361B138B",
  "A0C35EFFE722487BAB06864870A24D0F",
  "CF4DCD9BB106425A95773B519803438B",
  "CC20D7176DE9481CA20F81231F791D91",
  "0314E9F1674F490BAD79B4319F136C83",
  "0B82D3E1CCFC4BD6979FF97C94AD7AEE",
  "35C167A8A69C44C6901146BCBDA40868",
  "FD0F66F303254868A810F2EBAEEBEE9A",
  "C447BC8B5EDE47C39964C656BF05B108",
  "E6B28EBB913043C18933494E08FA055A",
  "D5DE0F46EEF341A383C94F3271F02925",
  "F3917E1E51AA450D9D18C66B5A2BD786",
  "E7403536FA54483B8A59905B91672F6B",
  "68CDB46365634548A07C5D65711A65B3",
  "58044DE6551C44B1B837C00135980489",
  "FCA7D42E5DDA4869A097A3CED48E7A22",
  "61E3A7AB87CA46758367DA75D701DCD6",
  "3A16B33FCC354D1EB138BAB806DF944A",
  "9089405D45634C35A798EC274EA35117",
  "23A0AA31DA424113B118E1545F724FFC",
  "559ADD94540E415FB281B0D7A3C90D95",
  "B1DAB4488047472B8339B0EB9E4061F0",
  "CF2B76B2905546AAB7CF4DF48A2FADF1",
  "09F3BB24F224418B874ECAF24B8D9CAE",
  "3EBFC9D817A84CE78745E23A7FEFC75D",
  "F3D823B5ACAE47D18CE70A79C40270B7",
  "0EEE9D2D27304253B6FE6C160035347F",
  "269271E3EBAA4C858EECEFDB0268ECE9",
  "2E80B6D3ABAF479386EBFD380A4D91A8",
  "B775228F6C414D36B66AC11ECBED905E",
  "614A322006D94D51985B163DEAEE28B3",
  "A8FC5F2843B04830926AA3936D92175E",
  "F7F26F634FA14298B3644461428C5235",
  "06F78509DDCF4F4A9E71E927B800BD82",
  "C605836AF3AF4A3C95B66C33E76EA782",
  "5B948D8F7CEA40F0B25CEEDB30415275",
  "9315995873EA4610B492459EA7C829A0",
  "9B2A9D01812D424296F0BE2F44BCFBB2",
  "9155D46C12524363AED914942F4ACAF8",
  "BF1C8DFFFC894528B9774A63D691F1A8",
  "616AF56E726A4531A45234B0AC750A68",
  "470F955948094E0A988927C18FA79332",
  "343E9336DED54EB5A6C31A113B347D7D",
  "124E724F13954961B0E310F48BC7BE5F",
  "8E87F2BBC6794601ADDDCB1A68ADD2CD",
  "BE55B35019B1449A83AF9EE7624F681F",
  "475241C33F7346D4B226B27E6A98729F",
  "39D6C87AB037466B9B72E6222B8C0F0C",
  "2BBE5937BBFE4785B52F3D7C76ECA488",
  "0208C5606A07456C9385EF2096200189",
  "30CEB64CC62B4D229B0679C35B95367F",
  "654617A0544B406E9CEF87AA74EE77A6",
  "3E4A0014FAD64E478F0876B7AC4BE18E",
  "4C93DAB1B37442D6A16EB9E375E8BD0A",
  "C19E87D09F14496EBA1DF7F00432D145",
  "7D7CA2D94591449098E71AB39C3E0E71",
  "617764D3AFA64FF4AA064F89244EFE75",
  "83AD70BC57084A1791FF075ECBD9B6C2",
  "011BAE6A4CE2441382BB78958F93D17D",
  "33AA135E2637478D90D198D800055C1D",
  "E675477C7BED4108BA6A2F66D83C4EBE",
  "C809D394C2CD4B3296F6F24D523DE626",
  "F2B578EB6E8A42F492A10DE747BFC18A",
  "C57A2DB009C54BE4B7A643E5C7178572",
  "EB3FD070E0B34CD9B9F3129C0C4F0137",
  "A5DD87C51D044489A83F3E76946D583E",
  "0B8D09A73ED140CF84C5320DAE27F350",
  "A09E5BE893AD458F962CAFB15189D7D7",
  "7FC54A2BBBA844EC88AC2A5565845AC7",
  "B2AE6B6C6C6C448E944D560048796462",
  "C5D221F3F24D4FC69E19B762A31A72F7",
  "DA8B15BC54254E0FBD50D7B01A50DBE8",
  "43AD75CE951840A2A1DA5F1452CFEF76",
  "DDBDAB1F7A064D20BF141E8B48C0C19A",
  "4BD45001E6CD42B294550A18DEDBC0B2",
  "24FFE0BDA1A4475B930831F327B0BDAC",
  "73027FE6F7834DF4945223C6D9BBC91F",
  "207E8CAE241C4C5E8E6EBFFB401AEA47",
  "E76ADCA2C1174B6CB484B1D56BB3270E",
  "DA482FE2174A465B93512F7ACFAFB4BF",
  "214E41BE5B29475D8B554B34A9290A07",
  "CCAE55BD0FA14D3BBD03CD4DBC761141",
  "213B82DA44A745FA804750396D9B1FB8",
  "7FE57D69C1494880853DE2F113880788",
  "5FA5C3EF9195444A832F0AE438613FE8",
  "363DEB2413FB48FD9D4CDCFD0EFE8171",
  "558C6C2E93914C0EBA625E42F900F002",
  "AE1915713E6D406ABCEED46C89E42282",
  "E458A546FAFC4A43895570E127E1EA05",
  "E29DEBF81BFD499FB98C2E5FBE185C4E",
  "C9BF53412788445E8DF6EA065AFFA0A6",
  "82ACF0E6EAF54359A0829C5958420F69",
  "BC9E6A6E734741679910D6D1A22E7643",
  "C69D887798B6438E9A8CDE24492B07AE",
  "0660BC35F9D84A76AD94D044AB3E2F03",
  "DEE6E272C4984FBFB0CAB3AC2CA380C6",
  "468663412E82440A8CA94360BB6691B3",
  "4C996CBA7A25444D9FFBD5938F22D79E",
  "97725CCC05DC4F978825D45FB3EB168C",
  "21C9CCA31AAC4871AF17A99AF86F6B8B",
  "FBE43D1FCAE84EDBBD1EBD3D94E73E9F",
  "5771BBE6465940CA82548F137A6790D9",
  "4AB0A44753C54C48B0C3F735CD088259",
  "ECAEFE5A63CA472C8E6CABBEFAC0539D",
  "3C66CEFE105C420CBDB539B9DCB3843C",
  "93A410F441A54BA1B25CA56C8974C7D1",
  "94C968BE05384FDA97F90AEF8F184D69",
  "5A1913E5D6BD434896085BD0361B138B",
  "A0C35EFFE722487BAB06864870A24D0F",
  "CF4DCD9BB106425A95773B519803438B",
  "CC20D7176DE9481CA20F81231F791D91",
  "0314E9F1674F490BAD79B4319F136C83",
  "0B82D3E1CCFC4BD6979FF97C94AD7AEE",
  "35C167A8A69C44C6901146BCBDA40868",
  "FD0F66F303254868A810F2EBAEEBEE9A",
  "C447BC8B5EDE47C39964C656BF05B108",
  "E6B28EBB913043C18933494E08FA055A",
  "D5DE0F46EEF341A383C94F3271F02925",
  "F3917E1E51AA450D9D18C66B5A2BD786",
  "E7403536FA54483B8A59905B91672F6B",
  "68CDB46365634548A07C5D65711A65B3",
  "58044DE6551C44B1B837C00135980489",
  "FCA7D42E5DDA4869A097A3CED48E7A22",
  "61E3A7AB87CA46758367DA75D701DCD6",
  "3A16B33FCC354D1EB138BAB806DF944A",
  "9089405D45634C35A798EC274EA35117",
  "23A0AA31DA424113B118E1545F724FFC",
  "559ADD94540E415FB281B0D7A3C90D95",
  "B1DAB4488047472B8339B0EB9E4061F0",
  "CF2B76B2905546AAB7CF4DF48A2FADF1",
  "09F3BB24F224418B874ECAF24B8D9CAE",
  "3EBFC9D817A84CE78745E23A7FEFC75D",
  "F3D823B5ACAE47D18CE70A79C40270B7",
  "0EEE9D2D27304253B6FE6C160035347F",
  "269271E3EBAA4C858EECEFDB0268ECE9",
  "2E80B6D3ABAF479386EBFD380A4D91A8",
  "B775228F6C414D36B66AC11ECBED905E",
  "614A322006D94D51985B163DEAEE28B3",
  "A8FC5F2843B04830926AA3936D92175E",
  "F7F26F634FA14298B3644461428C5235",
  "06F78509DDCF4F4A9E71E927B800BD82",
  "C605836AF3AF4A3C95B66C33E76EA782",
  "5B948D8F7CEA40F0B25CEEDB30415275",
  "9315995873EA4610B492459EA7C829A0",
  "9B2A9D01812D424296F0BE2F44BCFBB2",
  "9155D46C12524363AED914942F4ACAF8",
  "BF1C8DFFFC894528B9774A63D691F1A8",
  "616AF56E726A4531A45234B0AC750A68",
  "470F955948094E0A988927C18FA79332",
  "343E9336DED54EB5A6C31A113B347D7D",
  "124E724F13954961B0E310F48BC7BE5F",
  "8E87F2BBC6794601ADDDCB1A68ADD2CD",
  "BE55B35019B1449A83AF9EE7624F681F",
  "475241C33F7346D4B226B27E6A98729F",
  "39D6C87AB037466B9B72E6222B8C0F0C",
  "2BBE5937BBFE4785B52F3D7C76ECA488",
  "0208C5606A07456C9385EF2096200189",
  "30CEB64CC62B4D229B0679C35B95367F",
  "654617A0544B406E9CEF87AA74EE77A6",
  "3E4A0014FAD64E478F0876B7AC4BE18E",
  "4C93DAB1B37442D6A16EB9E375E8BD0A",
  "C19E87D09F14496EBA1DF7F00432D145",
  "7D7CA2D94591449098E71AB39C3E0E71",
  "617764D3AFA64FF4AA064F89244EFE75",
  "83AD70BC57084A1791FF075ECBD9B6C2", 
  "4B8B7F875E524C49BA7EB274963751EA",
  "002D321B2814496DA6BDA3438A04F646",
  "8FDF0D47B25D4A13B4085664588D99A1",
  "B7E848FCE2F045528290A5C19305F473",
  "B264D3ACA2EF47E8B5B10039A6A3AC2B",
  "E4352D48FD52407E94E20D9989E85947",
  "92800AB0E7A240A08354F6D7C361FB87",
  "4228725B2E8548CEB7D8A48CB40A69AA",
  "878E72361B994511ACF42CFCDCF85F7A",
  "1DF2D65FD113403BA445E4D1D405D8E8",
  "B11AF8F24643414FB9AFF56C0E6651C6",
  "6268652116C241B98B2F1597FB06299E",
  "D1A89569B68E47E0A04F5483F8E0725C",
  "7F24091345074A438184B9AA8F4D18A6",
  "33CB5930BD5C4FCFB8A271C254A05062",
  "F8D52DE7E5634302BB8D6890E6DDBA3F",
  "9DC3C9C233BB48E0ACFAA7B0355AAD74",
  "1C2131FAF1F2489DAFC777B518D8C1F6",
  "AFCEB73B491244FBA313937A1993B4FC",
  "E2047E298CF54A09AC5096D16E35328E",
  "92F937DB19A54C2BB3E3D63B74972ADC",
  "A3980FB12E25421DB75056DCBCE36285",
  "2ABC6ED4106141FCBBF98AF2778DA134",
  "25FF8876F4AE4F67971A4AB403102888",
  "9702C5138CDA4FC0AB5818B46369B1FF",
  "3A027EB458E1432AB5977770B373F0CB",
  "8700EB008CE34030B0340123853E161D",
  "17BA2CF285634057B9F2112F237D0263",
  "3483D6937BAD412F8398E3D8C9DAA243",
  "E89DC7CA6504422191C05269DDA4790F",
  "42FF083050AF433C816F9814AB577CC5",
  "FB184C52573B459A9A0EF62EBB06A22B",
  "338AB0BA972C491AA44D468CC03FE65E",
  "DF243E04841E4ECB8A3B35D547E6039C",
  "2A9426322C3440179E27437CC2A57230",
  "D323C2D081DA48DB8489D599DEAFB8AD",
  "DCE159BEC1C64CBA9AA794EC01939247",
  "FF29497E198347A1A0B930A89D72AEC5",
  "746BA4CC44A74AD2A5FAED30A1216317",
  "1A24AEAA97534FB2BC56EF43209C24E5",
  "B943EEA9B392471F89EA13197631BEB0",
  "7575F52613384629B721CACB16DD3E1C",
  "8B3DB01D0A7A4B90A265E9D5E51C5C06",
  "076C84CD834A4EC3A5D6ECE1E4C5EFB1",
  "8F2975A7F8E44D4889E89F61212BACA0",
  "F96D0F711C6046299002C4717B8D9957",
  "86D6F199CF644998A679A971B7A7305B",
  "B42FB369B5104E7EAB4BB0866A6F8EBE",
  "BA87EF5AF7CD4863B1401C8500D97F02",
  "0DC4E5E4E3F54AB787B592C3F95EEE28",
  "6C83E4A277D4435B8C934578B6E0D6B1",
  "A58C7AD722694AA5BAE29F3E2AF124CD",
  "AAC05B3E67784EFA8C48E2A76FA4186F",
  "6DD3F01138B1437F84357DA4197312F9",
  "ACFC0EF1E2E147509A903660C8F14F64",
  "E9C554921A30473FABBA12ACC64EA139",
  "35D406A965C04B7195DDF42F5A634C51",
  "557059E7F3DD4AB092A2BA1D52FB62C0",
  "AAD8E8180B9547378454557236AC1735",
  "59C61A14ED2241EC95576C1183199B67",
  "DD62120F4C7F48B7A8B48973EC2F2501",
  "3455B367F24049FEA4BF14D146F9BB2B",
  "6624AD9B1C9045258B912C9EA8A8FACC", 
  "BD174EF93A2949EDA9457121B3731AD1",
  "C84EE57B9A1047F393B8C43414D32C93",
  "E107954F4FE24A33AEF678327E6D64AE",
  "E428B0F28E6C4535BD63256321774F23",
  "EFEA43BDF59F4A31ABBB65B53B7A4813",
  "9E264DC46641457DB60FD8AF3DA3F298",
  "44186CFF828743288C16817BA3A492F7",
  "2734CB95451342758D412767C5CD4B98",
  "3F0C49D20259413AAAC3705E2C280442",
  "5B5C3D85087A4E16BBF4767641D407C0",
  "D4F16E2C121740D5A9EAA2A101B7474D",
  "ED0140E0071A4ACBA4A821244ED622E8",
  "5A0E181851844F289965BADE3F059431",
  "25833867AEB64E648F68326BA184BA5E",
  "F03CB47F15074DEA82BB0CC6F50606FF",
  "0C045E44B6AD44129157F4C5DC2C5BE2",
  "793BBA17C5924CF9BE7BFE71DC640818",
  "7732F490FE5143C1AB9D25403E7537F1",
  "C51E37CB62D44C3787853713D330759A",
  "E4B15697E2464233932835D22D259A51",
  "95416C0F6E064D71AB90B8C65922E1B7",
  "C6BEF133CFB74BFD9C7F25FB48C667F7",
  "024A30F51B314E1AB84AB61F16C87DF0",
  "8AB362E6607B4352B1C8DEA698C95D2E",
  "83FFDFF45A60445B930C6A2FF0D3F69A",
  "B1971BF51CC14294976150A9CB1B8784",
  "5DD08083232345419941C0C1408696DB",
  "6C0D8E38376245E689026BC1C36808A6",
  "656A7E7F733E454094A60ABCEA4ED5B1",
  "C27F3300D75D4915877833889EA5ACF9",
  "0870B39E7CB348DBB74699311458D574",
  "5EF44FDA4E464CDEA4370DB69E23EBC7",
  "242540AED1C7463890838C715C926676",
  "4C35087FD53F4068A3EC085623BDA755",
  "A47B50162D1148BF9E383D9BB5DC4364",
  "F8BA7AD609084D4E994EBF421D272DB7",
  "9EFEB9D613A14CADBE12FE3254EB7E7F",
  "1E7E3D7A5A5948DFA7B6FBB147749B4F",
  "308EA3A6D1B0476B97CA33AB867F3DFD",
  "9F32556685C146DABA095579D0D1D18A",
  "CEBF611093FE4724846E72CF45263B23",
  "D503D41A56C747E580B25692E2394C7F",
  "FE85B422A2E847B9AA1B39A69534BBC9",
  "F8DD4AC94ADF4E89A05B24DC781C761F",
  "15FB8938DB8B4885A5A995ABADB04697"
), ]
  

#All data management done for "data" csv will translate when subset to data_correct


#results for the main paper: no controls, mediated by CN.Score----------------

# Fit the model

model_nc <- estimatr::lm_robust(CN_IDENTIFICATION ~ Treatment + as.numeric(CN.Score),
                              data = data_correct)
summary(model_nc)

linhyp_model_nc <- car::linearHypothesis(model_nc, "TreatmentP = TreatmentN")
linhyp_model_nc


#output tables
# Positive vs negative - Ha1 and Ha2
main_list_nc <- list(model_nc)
texreg(main_list_nc, include.ci = FALSE)




#public ID-----------------------

# Calculate the public_id_scale 
data_correct <- data_correct %>%
  mutate(public_id_scale = rowMeans(select(., FRIEND_EVENT_CN, CN_WE, FUTHER_CONVERSATION), na.rm = TRUE))

#Creating scale for public identification: using questions FRIEND_EVENT_CN, CN_WE, FURTHER_CONVERSATION
data_correct$public_id_scale <-  rowMeans(data_correct[, c("FRIEND_EVENT_CN", "CN_WE", "FUTHER_CONVERSATION")], na.rm = TRUE)

#without friend_event_cn
data_correct$public_id_scale_2 <-  rowMeans(data_correct[, c("CN_WE", "FUTHER_CONVERSATION")], na.rm = TRUE)

#Regressions

# Run the linear regression model
model_public_nc <- estimatr::lm_robust(public_id_scale ~ Treatment+ as.numeric(CN.Score), 
                                       data = data_correct)
summary(model_public_nc)

linhyp_public_nc <- car::linearHypothesis(model_public_nc, "TreatmentP = TreatmentN")
linhyp_public_nc

#without friend metric in scale 
model_public_nc2 <- estimatr::lm_robust(public_id_scale_2 ~ Treatment+ as.numeric(CN.Score), 
                                       data = data_correct)
summary(model_public_nc2)


#output tables
# Positive vs negative - Ha1 and Ha2
public_list_nc <- list(model_public_nc)
texreg(public_list_nc, include.ci = FALSE)


#Durability check results for main paper ------------
dur_data <- read.csv('/Users/amygrauley/Desktop/Notre Dame/CN Elite Cues Experiment/EXP 1 DUR DATA FINAL.csv')

dur_data_correct <- dur_data[!data$participantId %in% c(
  "011BAE6A4CE2441382BB78958F93D17D",
  "33AA135E2637478D90D198D800055C1D",
  "E675477C7BED4108BA6A2F66D83C4EBE",
  "C809D394C2CD4B3296F6F24D523DE626",
  "F2B578EB6E8A42F492A10DE747BFC18A",
  "C57A2DB009C54BE4B7A643E5C7178572",
  "EB3FD070E0B34CD9B9F3129C0C4F0137",
  "A5DD87C51D044489A83F3E76946D583E",
  "0B8D09A73ED140CF84C5320DAE27F350",
  "A09E5BE893AD458F962CAFB15189D7D7",
  "7FC54A2BBBA844EC88AC2A5565845AC7",
  "B2AE6B6C6C6C448E944D560048796462",
  "C5D221F3F24D4FC69E19B762A31A72F7",
  "DA8B15BC54254E0FBD50D7B01A50DBE8",
  "43AD75CE951840A2A1DA5F1452CFEF76",
  "DDBDAB1F7A064D20BF141E8B48C0C19A",
  "4BD45001E6CD42B294550A18DEDBC0B2",
  "24FFE0BDA1A4475B930831F327B0BDAC",
  "73027FE6F7834DF4945223C6D9BBC91F",
  "207E8CAE241C4C5E8E6EBFFB401AEA47",
  "E76ADCA2C1174B6CB484B1D56BB3270E",
  "DA482FE2174A465B93512F7ACFAFB4BF",
  "214E41BE5B29475D8B554B34A9290A07",
  "CCAE55BD0FA14D3BBD03CD4DBC761141",
  "213B82DA44A745FA804750396D9B1FB8",
  "7FE57D69C1494880853DE2F113880788",
  "5FA5C3EF9195444A832F0AE438613FE8",
  "363DEB2413FB48FD9D4CDCFD0EFE8171",
  "558C6C2E93914C0EBA625E42F900F002",
  "AE1915713E6D406ABCEED46C89E42282",
  "E458A546FAFC4A43895570E127E1EA05",
  "E29DEBF81BFD499FB98C2E5FBE185C4E",
  "C9BF53412788445E8DF6EA065AFFA0A6",
  "82ACF0E6EAF54359A0829C5958420F69",
  "BC9E6A6E734741679910D6D1A22E7643",
  "C69D887798B6438E9A8CDE24492B07AE",
  "0660BC35F9D84A76AD94D044AB3E2F03",
  "DEE6E272C4984FBFB0CAB3AC2CA380C6",
  "468663412E82440A8CA94360BB6691B3",
  "4C996CBA7A25444D9FFBD5938F22D79E",
  "97725CCC05DC4F978825D45FB3EB168C",
  "21C9CCA31AAC4871AF17A99AF86F6B8B",
  "FBE43D1FCAE84EDBBD1EBD3D94E73E9F",
  "5771BBE6465940CA82548F137A6790D9",
  "4AB0A44753C54C48B0C3F735CD088259",
  "ECAEFE5A63CA472C8E6CABBEFAC0539D",
  "3C66CEFE105C420CBDB539B9DCB3843C",
  "93A410F441A54BA1B25CA56C8974C7D1",
  "94C968BE05384FDA97F90AEF8F184D69",
  "5A1913E5D6BD434896085BD0361B138B",
  "A0C35EFFE722487BAB06864870A24D0F",
  "CF4DCD9BB106425A95773B519803438B",
  "CC20D7176DE9481CA20F81231F791D91",
  "0314E9F1674F490BAD79B4319F136C83",
  "0B82D3E1CCFC4BD6979FF97C94AD7AEE",
  "35C167A8A69C44C6901146BCBDA40868",
  "FD0F66F303254868A810F2EBAEEBEE9A",
  "C447BC8B5EDE47C39964C656BF05B108",
  "E6B28EBB913043C18933494E08FA055A",
  "D5DE0F46EEF341A383C94F3271F02925",
  "F3917E1E51AA450D9D18C66B5A2BD786",
  "E7403536FA54483B8A59905B91672F6B",
  "68CDB46365634548A07C5D65711A65B3",
  "58044DE6551C44B1B837C00135980489",
  "FCA7D42E5DDA4869A097A3CED48E7A22",
  "61E3A7AB87CA46758367DA75D701DCD6",
  "3A16B33FCC354D1EB138BAB806DF944A",
  "9089405D45634C35A798EC274EA35117",
  "23A0AA31DA424113B118E1545F724FFC",
  "559ADD94540E415FB281B0D7A3C90D95",
  "B1DAB4488047472B8339B0EB9E4061F0",
  "CF2B76B2905546AAB7CF4DF48A2FADF1",
  "09F3BB24F224418B874ECAF24B8D9CAE",
  "3EBFC9D817A84CE78745E23A7FEFC75D",
  "F3D823B5ACAE47D18CE70A79C40270B7",
  "0EEE9D2D27304253B6FE6C160035347F",
  "269271E3EBAA4C858EECEFDB0268ECE9",
  "2E80B6D3ABAF479386EBFD380A4D91A8",
  "B775228F6C414D36B66AC11ECBED905E",
  "614A322006D94D51985B163DEAEE28B3",
  "A8FC5F2843B04830926AA3936D92175E",
  "F7F26F634FA14298B3644461428C5235",
  "06F78509DDCF4F4A9E71E927B800BD82",
  "C605836AF3AF4A3C95B66C33E76EA782",
  "5B948D8F7CEA40F0B25CEEDB30415275",
  "9315995873EA4610B492459EA7C829A0",
  "9B2A9D01812D424296F0BE2F44BCFBB2",
  "9155D46C12524363AED914942F4ACAF8",
  "BF1C8DFFFC894528B9774A63D691F1A8",
  "616AF56E726A4531A45234B0AC750A68",
  "470F955948094E0A988927C18FA79332",
  "343E9336DED54EB5A6C31A113B347D7D",
  "124E724F13954961B0E310F48BC7BE5F",
  "8E87F2BBC6794601ADDDCB1A68ADD2CD",
  "BE55B35019B1449A83AF9EE7624F681F",
  "475241C33F7346D4B226B27E6A98729F",
  "39D6C87AB037466B9B72E6222B8C0F0C",
  "2BBE5937BBFE4785B52F3D7C76ECA488",
  "0208C5606A07456C9385EF2096200189",
  "30CEB64CC62B4D229B0679C35B95367F",
  "654617A0544B406E9CEF87AA74EE77A6",
  "3E4A0014FAD64E478F0876B7AC4BE18E",
  "4C93DAB1B37442D6A16EB9E375E8BD0A",
  "C19E87D09F14496EBA1DF7F00432D145",
  "7D7CA2D94591449098E71AB39C3E0E71",
  "617764D3AFA64FF4AA064F89244EFE75",
  "83AD70BC57084A1791FF075ECBD9B6C2",
  "011BAE6A4CE2441382BB78958F93D17D",
  "33AA135E2637478D90D198D800055C1D",
  "E675477C7BED4108BA6A2F66D83C4EBE",
  "C809D394C2CD4B3296F6F24D523DE626",
  "F2B578EB6E8A42F492A10DE747BFC18A",
  "C57A2DB009C54BE4B7A643E5C7178572",
  "EB3FD070E0B34CD9B9F3129C0C4F0137",
  "A5DD87C51D044489A83F3E76946D583E",
  "0B8D09A73ED140CF84C5320DAE27F350",
  "A09E5BE893AD458F962CAFB15189D7D7",
  "7FC54A2BBBA844EC88AC2A5565845AC7",
  "B2AE6B6C6C6C448E944D560048796462",
  "C5D221F3F24D4FC69E19B762A31A72F7",
  "DA8B15BC54254E0FBD50D7B01A50DBE8",
  "43AD75CE951840A2A1DA5F1452CFEF76",
  "DDBDAB1F7A064D20BF141E8B48C0C19A",
  "4BD45001E6CD42B294550A18DEDBC0B2",
  "24FFE0BDA1A4475B930831F327B0BDAC",
  "73027FE6F7834DF4945223C6D9BBC91F",
  "207E8CAE241C4C5E8E6EBFFB401AEA47",
  "E76ADCA2C1174B6CB484B1D56BB3270E",
  "DA482FE2174A465B93512F7ACFAFB4BF",
  "214E41BE5B29475D8B554B34A9290A07",
  "CCAE55BD0FA14D3BBD03CD4DBC761141",
  "213B82DA44A745FA804750396D9B1FB8",
  "7FE57D69C1494880853DE2F113880788",
  "5FA5C3EF9195444A832F0AE438613FE8",
  "363DEB2413FB48FD9D4CDCFD0EFE8171",
  "558C6C2E93914C0EBA625E42F900F002",
  "AE1915713E6D406ABCEED46C89E42282",
  "E458A546FAFC4A43895570E127E1EA05",
  "E29DEBF81BFD499FB98C2E5FBE185C4E",
  "C9BF53412788445E8DF6EA065AFFA0A6",
  "82ACF0E6EAF54359A0829C5958420F69",
  "BC9E6A6E734741679910D6D1A22E7643",
  "C69D887798B6438E9A8CDE24492B07AE",
  "0660BC35F9D84A76AD94D044AB3E2F03",
  "DEE6E272C4984FBFB0CAB3AC2CA380C6",
  "468663412E82440A8CA94360BB6691B3",
  "4C996CBA7A25444D9FFBD5938F22D79E",
  "97725CCC05DC4F978825D45FB3EB168C",
  "21C9CCA31AAC4871AF17A99AF86F6B8B",
  "FBE43D1FCAE84EDBBD1EBD3D94E73E9F",
  "5771BBE6465940CA82548F137A6790D9",
  "4AB0A44753C54C48B0C3F735CD088259",
  "ECAEFE5A63CA472C8E6CABBEFAC0539D",
  "3C66CEFE105C420CBDB539B9DCB3843C",
  "93A410F441A54BA1B25CA56C8974C7D1",
  "94C968BE05384FDA97F90AEF8F184D69",
  "5A1913E5D6BD434896085BD0361B138B",
  "A0C35EFFE722487BAB06864870A24D0F",
  "CF4DCD9BB106425A95773B519803438B",
  "CC20D7176DE9481CA20F81231F791D91",
  "0314E9F1674F490BAD79B4319F136C83",
  "0B82D3E1CCFC4BD6979FF97C94AD7AEE",
  "35C167A8A69C44C6901146BCBDA40868",
  "FD0F66F303254868A810F2EBAEEBEE9A",
  "C447BC8B5EDE47C39964C656BF05B108",
  "E6B28EBB913043C18933494E08FA055A",
  "D5DE0F46EEF341A383C94F3271F02925",
  "F3917E1E51AA450D9D18C66B5A2BD786",
  "E7403536FA54483B8A59905B91672F6B",
  "68CDB46365634548A07C5D65711A65B3",
  "58044DE6551C44B1B837C00135980489",
  "FCA7D42E5DDA4869A097A3CED48E7A22",
  "61E3A7AB87CA46758367DA75D701DCD6",
  "3A16B33FCC354D1EB138BAB806DF944A",
  "9089405D45634C35A798EC274EA35117",
  "23A0AA31DA424113B118E1545F724FFC",
  "559ADD94540E415FB281B0D7A3C90D95",
  "B1DAB4488047472B8339B0EB9E4061F0",
  "CF2B76B2905546AAB7CF4DF48A2FADF1",
  "09F3BB24F224418B874ECAF24B8D9CAE",
  "3EBFC9D817A84CE78745E23A7FEFC75D",
  "F3D823B5ACAE47D18CE70A79C40270B7",
  "0EEE9D2D27304253B6FE6C160035347F",
  "269271E3EBAA4C858EECEFDB0268ECE9",
  "2E80B6D3ABAF479386EBFD380A4D91A8",
  "B775228F6C414D36B66AC11ECBED905E",
  "614A322006D94D51985B163DEAEE28B3",
  "A8FC5F2843B04830926AA3936D92175E",
  "F7F26F634FA14298B3644461428C5235",
  "06F78509DDCF4F4A9E71E927B800BD82",
  "C605836AF3AF4A3C95B66C33E76EA782",
  "5B948D8F7CEA40F0B25CEEDB30415275",
  "9315995873EA4610B492459EA7C829A0",
  "9B2A9D01812D424296F0BE2F44BCFBB2",
  "9155D46C12524363AED914942F4ACAF8",
  "BF1C8DFFFC894528B9774A63D691F1A8",
  "616AF56E726A4531A45234B0AC750A68",
  "470F955948094E0A988927C18FA79332",
  "343E9336DED54EB5A6C31A113B347D7D",
  "124E724F13954961B0E310F48BC7BE5F",
  "8E87F2BBC6794601ADDDCB1A68ADD2CD",
  "BE55B35019B1449A83AF9EE7624F681F",
  "475241C33F7346D4B226B27E6A98729F",
  "39D6C87AB037466B9B72E6222B8C0F0C",
  "2BBE5937BBFE4785B52F3D7C76ECA488",
  "0208C5606A07456C9385EF2096200189",
  "30CEB64CC62B4D229B0679C35B95367F",
  "654617A0544B406E9CEF87AA74EE77A6",
  "3E4A0014FAD64E478F0876B7AC4BE18E",
  "4C93DAB1B37442D6A16EB9E375E8BD0A",
  "C19E87D09F14496EBA1DF7F00432D145",
  "7D7CA2D94591449098E71AB39C3E0E71",
  "617764D3AFA64FF4AA064F89244EFE75",
  "83AD70BC57084A1791FF075ECBD9B6C2", 
  "4B8B7F875E524C49BA7EB274963751EA",
  "002D321B2814496DA6BDA3438A04F646",
  "8FDF0D47B25D4A13B4085664588D99A1",
  "B7E848FCE2F045528290A5C19305F473",
  "B264D3ACA2EF47E8B5B10039A6A3AC2B",
  "E4352D48FD52407E94E20D9989E85947",
  "92800AB0E7A240A08354F6D7C361FB87",
  "4228725B2E8548CEB7D8A48CB40A69AA",
  "878E72361B994511ACF42CFCDCF85F7A",
  "1DF2D65FD113403BA445E4D1D405D8E8",
  "B11AF8F24643414FB9AFF56C0E6651C6",
  "6268652116C241B98B2F1597FB06299E",
  "D1A89569B68E47E0A04F5483F8E0725C",
  "7F24091345074A438184B9AA8F4D18A6",
  "33CB5930BD5C4FCFB8A271C254A05062",
  "F8D52DE7E5634302BB8D6890E6DDBA3F",
  "9DC3C9C233BB48E0ACFAA7B0355AAD74",
  "1C2131FAF1F2489DAFC777B518D8C1F6",
  "AFCEB73B491244FBA313937A1993B4FC",
  "E2047E298CF54A09AC5096D16E35328E",
  "92F937DB19A54C2BB3E3D63B74972ADC",
  "A3980FB12E25421DB75056DCBCE36285",
  "2ABC6ED4106141FCBBF98AF2778DA134",
  "25FF8876F4AE4F67971A4AB403102888",
  "9702C5138CDA4FC0AB5818B46369B1FF",
  "3A027EB458E1432AB5977770B373F0CB",
  "8700EB008CE34030B0340123853E161D",
  "17BA2CF285634057B9F2112F237D0263",
  "3483D6937BAD412F8398E3D8C9DAA243",
  "E89DC7CA6504422191C05269DDA4790F",
  "42FF083050AF433C816F9814AB577CC5",
  "FB184C52573B459A9A0EF62EBB06A22B",
  "338AB0BA972C491AA44D468CC03FE65E",
  "DF243E04841E4ECB8A3B35D547E6039C",
  "2A9426322C3440179E27437CC2A57230",
  "D323C2D081DA48DB8489D599DEAFB8AD",
  "DCE159BEC1C64CBA9AA794EC01939247",
  "FF29497E198347A1A0B930A89D72AEC5",
  "746BA4CC44A74AD2A5FAED30A1216317",
  "1A24AEAA97534FB2BC56EF43209C24E5",
  "B943EEA9B392471F89EA13197631BEB0",
  "7575F52613384629B721CACB16DD3E1C",
  "8B3DB01D0A7A4B90A265E9D5E51C5C06",
  "076C84CD834A4EC3A5D6ECE1E4C5EFB1",
  "8F2975A7F8E44D4889E89F61212BACA0",
  "F96D0F711C6046299002C4717B8D9957",
  "86D6F199CF644998A679A971B7A7305B",
  "B42FB369B5104E7EAB4BB0866A6F8EBE",
  "BA87EF5AF7CD4863B1401C8500D97F02",
  "0DC4E5E4E3F54AB787B592C3F95EEE28",
  "6C83E4A277D4435B8C934578B6E0D6B1",
  "A58C7AD722694AA5BAE29F3E2AF124CD",
  "AAC05B3E67784EFA8C48E2A76FA4186F",
  "6DD3F01138B1437F84357DA4197312F9",
  "ACFC0EF1E2E147509A903660C8F14F64",
  "E9C554921A30473FABBA12ACC64EA139",
  "35D406A965C04B7195DDF42F5A634C51",
  "557059E7F3DD4AB092A2BA1D52FB62C0",
  "AAD8E8180B9547378454557236AC1735",
  "59C61A14ED2241EC95576C1183199B67",
  "DD62120F4C7F48B7A8B48973EC2F2501",
  "3455B367F24049FEA4BF14D146F9BB2B",
  "6624AD9B1C9045258B912C9EA8A8FACC", 
  "BD174EF93A2949EDA9457121B3731AD1",
  "C84EE57B9A1047F393B8C43414D32C93",
  "E107954F4FE24A33AEF678327E6D64AE",
  "E428B0F28E6C4535BD63256321774F23",
  "EFEA43BDF59F4A31ABBB65B53B7A4813",
  "9E264DC46641457DB60FD8AF3DA3F298",
  "44186CFF828743288C16817BA3A492F7",
  "2734CB95451342758D412767C5CD4B98",
  "3F0C49D20259413AAAC3705E2C280442",
  "5B5C3D85087A4E16BBF4767641D407C0",
  "D4F16E2C121740D5A9EAA2A101B7474D",
  "ED0140E0071A4ACBA4A821244ED622E8",
  "5A0E181851844F289965BADE3F059431",
  "25833867AEB64E648F68326BA184BA5E",
  "F03CB47F15074DEA82BB0CC6F50606FF",
  "0C045E44B6AD44129157F4C5DC2C5BE2",
  "793BBA17C5924CF9BE7BFE71DC640818",
  "7732F490FE5143C1AB9D25403E7537F1",
  "C51E37CB62D44C3787853713D330759A",
  "E4B15697E2464233932835D22D259A51",
  "95416C0F6E064D71AB90B8C65922E1B7",
  "C6BEF133CFB74BFD9C7F25FB48C667F7",
  "024A30F51B314E1AB84AB61F16C87DF0",
  "8AB362E6607B4352B1C8DEA698C95D2E",
  "83FFDFF45A60445B930C6A2FF0D3F69A",
  "B1971BF51CC14294976150A9CB1B8784",
  "5DD08083232345419941C0C1408696DB",
  "6C0D8E38376245E689026BC1C36808A6",
  "656A7E7F733E454094A60ABCEA4ED5B1",
  "C27F3300D75D4915877833889EA5ACF9",
  "0870B39E7CB348DBB74699311458D574",
  "5EF44FDA4E464CDEA4370DB69E23EBC7",
  "242540AED1C7463890838C715C926676",
  "4C35087FD53F4068A3EC085623BDA755",
  "A47B50162D1148BF9E383D9BB5DC4364",
  "F8BA7AD609084D4E994EBF421D272DB7",
  "9EFEB9D613A14CADBE12FE3254EB7E7F",
  "1E7E3D7A5A5948DFA7B6FBB147749B4F",
  "308EA3A6D1B0476B97CA33AB867F3DFD",
  "9F32556685C146DABA095579D0D1D18A",
  "CEBF611093FE4724846E72CF45263B23",
  "D503D41A56C747E580B25692E2394C7F",
  "FE85B422A2E847B9AA1B39A69534BBC9",
  "F8DD4AC94ADF4E89A05B24DC781C761F",
  "15FB8938DB8B4885A5A995ABADB04697"
), ]



#coding social ties measurement of CN as numeric , 5= most CN
dur_data_correct <- dur_data_correct %>%
  mutate(DURABILITY_1. = case_when(
    DURABILITY_1. == "Yes" ~ 5, 
    DURABILITY_1. == "Maybe yes" ~ 4, 
    DURABILITY_1. == "Unsure/Don't Know" ~ 3, 
    DURABILITY_1. == "Maybe no" ~ 2, 
    DURABILITY_1. == "No" ~ 1))

#coding conversational identification measurement of CN as numeric , 5= most CN
dur_data_correct <- dur_data_correct %>%
  mutate(DURABILITY_2 = case_when(
    DURABILITY_2 == "Always" ~ 5, 
    DURABILITY_2 == "Often" ~ 4, 
    DURABILITY_2 == "Seldom" ~ 3, 
    DURABILITY_2 == "Never" ~ 2, 
    DURABILITY_2 == "Other:" ~ 1))

#coding CN measurement as numeric, 5= most CN
dur_data_correct <- dur_data_correct %>%
  mutate(DURABILITY_3 = case_when( 
    DURABILITY_3 == "Strongly disagree" ~ 1, 
    DURABILITY_3 == "Somewhat disagree" ~ 2, 
    DURABILITY_3 == "Neither agree nor disagree" ~ 3, 
    DURABILITY_3 == "Somewhat agree" ~ 4, 
    DURABILITY_3 == "Strongly agree" ~ 5))

#coding public identification with researcher contact as numeric, 5= most CN
dur_data_correct <- dur_data_correct %>%
  mutate(DURABILITY_4 = case_when( 
    DURABILITY_4 == "Yes" ~ 5, 
    DURABILITY_4 == "No, but I do identify with Christian Nationalism" ~ 3, 
    DURABILITY_4 == "No, because I do not identify with Christian Nationalism" ~ 1))

#adding the treatment into the data frame
#creating a data frame that pulls ID and treatment assignment from data_correct 
# Subset the data_correct data frame to select only the required columns
new_columns <- data_correct[, c("participantId", "Treatment", "block_id", "race_binary", 
                                "PID", "REL_IMPORTANCE", "CN_ISSUE_3", "CN.Score", 
                                "RACE", "GENDER", "IDEOLOGY.", "INCOME", "AGE", "RELIGION", "public_id_scale")]

# Merge  with dur_data_correct based on participantId
dur_data_correct <- merge(dur_data_correct, new_columns, by = "participantId")


dur_data_correct <- na.omit(dur_data_correct)

# Fit the model

dur_check <- estimatr::lm_robust(DURABILITY_3 ~ Treatment + as.numeric(CN.Score),
                                data = dur_data_correct)
summary(dur_check)

linhyp_dur_check <- car::linearHypothesis(dur_check, "TreatmentP = TreatmentN")
linhyp_dur_check


#public ID durability check
dur_check_pub <- estimatr::lm_robust(public_id_scale ~ Treatment + as.numeric(CN.Score),
                                 data = dur_data_correct)
summary(dur_check_pub)

linhyp_dur_check_pub <- car::linearHypothesis(dur_check_pub, "TreatmentP = TreatmentN")
linhyp_dur_check_pub


